<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">
   
    <ui:define name="titulo">
        Web Banco
    </ui:define>
    
    <ui:define name="corpo">
        
        <h:form>
         
        <p:panel id="painelP" widgetVar="painel" closable="true"  visible="false">

                <p:effect type="clip" event="load" for="painelP" speed="1000" >  
                    <f:param name="mode" value="'show'" />  
                </p:effect> 
            <p:panel header="#{principalMB.cliente.nome}" >
                 
                    <h:panelGrid columns="4" cellpadding="5">
                        
                            <h:outputLabel value="Nº Conta: " /> 
                            <p:inputText value="#{principalMB.cliente.nConta}" readonly="true" size="5"/>
                        
                            <h:outputLabel value="CPF: " />
                            <p:inputText value="#{principalMB.cliente.cpf}" readonly="true" size="30"/>
                            
                            <h:outputLabel value="Saldo: " />
                            <p:inputText readonly="true" value="#{principalMB.cliente.saldo}"  size="20">
                                <f:convertNumber  type="currency" locale="pt,BR"/> 
                            </p:inputText>
                            
                            <h:inputHidden/>
                            
                           <h:panelGroup layout="block" style="text-align: right" >
                               
                               <p:commandButton  ajax="false" value="Nova Transferência"  action="novaTransferencia"/>
                               
                            </h:panelGroup>
                        
                    </h:panelGrid>
                    
                </p:panel>
                
            
                <p:spacer/>
            
                    
                    <p:dataTable  style="margin-top: 20px;text-align:left;" id="basic" var="transferencia" value="#{principalMB.transferencias}" emptyMessage="Não há transferencias desta conta."
                                 scrollable="true"  scrollHeight="250" >  
                        <p:column id="modelHeader" width="240" style="text-align: center">  
                            <f:facet name="header">  
                                    De  
                            </f:facet>  
                            <h:outputText value="#{transferencia.clienteOrigem.nome}" />  
                        </p:column>  

                        <p:column width="240" style="text-align: center">  
                            <f:facet name="header" >  
                                    Para  
                            </f:facet>  
                            <h:outputText value="#{transferencia.clienteDestino.nome}" />  
                        </p:column>  

                        <p:column width="175" style="text-align: center">  
                            <f:facet name="header">  
                                    Data/Hora  
                            </f:facet>  
                            <h:outputText value="#{transferencia.dataHora}">
                                <f:convertDateTime timeZone="GMT-3" pattern="dd/MM/yyyy HH:mm:ss"/> 
                            </h:outputText>
                        </p:column>  

                        <p:column width="100" style="text-align: right">  
                            <f:facet name="header">  
                                    Valor  
                            </f:facet>  
                            <h:outputText value="#{transferencia.valor}">
                                <f:convertNumber  type="currency" currencySymbol=""/>
                            </h:outputText>
                        </p:column>  
                    </p:dataTable>  
                
                
         
        </p:panel>
        </h:form>
    </ui:define>
    
</ui:composition>


